package com.zhangshuo.patternDesign.vistor;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by shuo.zhang on 2017-11-04.
 */
public class AccountBook {

    private List<IBill> billList;

    public AccountBook() {
        this.billList = new ArrayList<>();
    }

    /**
     * 查帐
     * @param visitor
     */
    public void show(IVisitor visitor) {

        billList.forEach((bill) ->
                bill.accept(visitor)
        );
    }

    /**
     * 新增账目
     * @param bill
     * @return
     */
    public boolean addBill(IBill bill){
        return this.billList.add(bill);
    }

}
